//
//  LoginController.m
//  village_ios
//
//  Created by mac on 2019/8/11.
//  Copyright © 2019 com.sw.village. All rights reserved.
//

#import "RegisterPhoneCodeController.h"
#import "RegisterRequest.h"
#import "UIStoryboard+Helper.h"
#import "RegisterPasswordController.h"

@interface RegisterPhoneCodeController ()
@property (weak, nonatomic) IBOutlet UITextField *codeTextField;

@end

@implementation RegisterPhoneCodeController

+ (instancetype)instanceWithStoryBoard {

    NSString *className = NSStringFromClass([self class]);
    id vc = [UIStoryboard storyboardWithName:@"RegisterController" viewControllerIdentifier:className];
    return vc;
}
- (void)viewDidLoad {
    [super viewDidLoad];

}
- (IBAction)toSendCode:(id)sender {

    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [SYProgressHUD show];
    [APIManager requestWithUrlString:@"api/kaptcha/addItem" params:params method:@"GET" success:^(id response) {
        
        [self reloadAllData];
    } failure:^(NSError *error) {
        [self reloadErrorData];
    }];
}

- (IBAction)toNext:(id)sender {

    self.registerRequest = [RegisterRequest new];
    self.registerRequest.code = self.codeTextField.text;

    RegisterPasswordController *vc = [RegisterPasswordController instanceWithStoryBoard];
    vc.registerRequest = self.registerRequest;
    [self.navigationController pushViewController:vc animated:YES];
}

@end
